import os
import traceback

import yaml
from py import log

path = "C:\\Users\\Administrator\\PycharmProjects\\guang_business_ui\\resource\\data.yaml"


def read_yaml_file(class_name,case_name):
    try:
        with open(path, encoding='utf-8') as f:
            caseinfo = yaml.load(stream=f, Loader=yaml.FullLoader)
            class_caseinfo = caseinfo[class_name]  # 传入类名及方法名
            method_caseinfo = []
            for i in range(0,len(class_caseinfo),1):
                if list(class_caseinfo[i].keys())[0] == case_name:
                    method_caseinfo.append(class_caseinfo[i].get(case_name))
            return method_caseinfo
    except Exception as f:
        print(f)
